package wsz.filter;

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;

/**
 * TODO：spi模拟过滤
 * 其他module直接依赖即可
 *
 * @author wsz
 * @desc：
 * @date 2021/12/13
 */
@Activate(group = {CommonConstants.CONSUMER})
public class DubboInvokeFilter implements Filter {
    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        long start = System.currentTimeMillis();
        try {
            return invoker.invoke(invocation);
        } finally {
            System.out.println("invoke time:"+(System.currentTimeMillis()-start) + "毫秒");
        }
    }
}
